﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace EWSEditor.CRM
{
    public class ExchangeFolderSyncState
    {
        public string FolderId
        {
            get { return _folderId; }
        }

        private string _folderId;

        public string FolderName
        {
            get { return _folderName; }
        }

        private string _folderName;

        public string FolderClass
        {
            get { return _folderClass; }
        }

        private string _folderClass;

        public string SyncState
        {
            get { return _syncState; }
        }

        public string _syncState;

        /// <summary>
        /// Constructor called from ExchangeSyncStatexml
        /// </summary>
        /// <param name="nodedoc">The node representing the requested FolderSyncState</param>
        public ExchangeFolderSyncState(XmlNode nodedoc)
        {
            SetProperties(nodedoc);
        }

        public void SetProperties(XmlNode nodedoc)
        {
            foreach (XmlNode childnode in nodedoc)
            {
                switch (childnode.Name)
                {
                    case "FolderId":
                        _folderId = childnode.InnerText;
                        break;

                    case "FolderName":
                        _folderName = childnode.InnerText;
                        break;

                    case "FolderClass":
                        _folderClass = childnode.InnerText;
                        break;

                    case "SyncState":
                        _syncState = childnode.InnerText;
                        break;
                }
            }
        }
    }
}
